import { create } from 'zustand'
import { createJSONStorage, persist } from 'zustand/middleware'
import RememberMeLoginInfoDto from '@/core/auth/types/model/dto/RememberMeLoginInfoDto'
import globalConfig from '@/core/framework/config/globalConfig'

const useRememberMeLoginInfoStore = create(
	persist<RememberMeLoginInfoDto | null>(
		(setState, getState) => {
			return null
		},
		{
			name: `${globalConfig.storageKeyPrefix}.rememberMe`,
			storage: createJSONStorage(() => localStorage),
		},
	),
)

export default useRememberMeLoginInfoStore
